{% extends "template/addEdit.volt" %}

{% block title %}自定义消息推送BETA版本{% endblock %}

{% block content %}
    <table class="single">
        <tr>
            <th>接收人:</th>
            <td><select name="user" id="userId">
                    {% for user in userList %}
                        <option value="{{ user['id'] }}">{{ user['nickname'] }}</option>
                    {% endfor %}
                </select></td>
        </tr>
        <tr>
            <th>标题:</th>
            <td><input type="text" value="" id="titile" data-valid="text"/></td>
        </tr>
    </table>
    <div id="editor" class="single"></div>
{% endblock %}

{% block jscontent %}
    <script type="text/javascript" src="/third-part/wang-editor/wangEditor.min.js"></script>

    <script>
        var editor;
        $(function () {
            var E = window.wangEditor;
            editor = new E('#editor');
            // 或者 var editor = new E( document.getElementById('#editor') )
            editor.create();
        })

        function addAction() {
            
            feimaPost("/notification/doSendMessage", {
                "user": $("#userId").val(),
                "title": $("#titile").val(),
                "content":editor.txt.text()
            }, function (result) {
                FAlert(result.message);
            });

        }
    </script>
{% endblock %}
